<div class="bg-light lter b-b wrapper-md">
    <h1 class="m-n font-thin h3">
        <span class="font-bold" translate="aside.nav.system.userManager">User manager</span>
    </h1>
</div>
<div ng-class="isSmart?'':'wrapper-md'" class="remove-wrapper" ng-controller="SystemUserController" ng-init="init()">
    <div class="panel panel-default">
        <div class="wrapper-md" style="">
            <div class="input-group">
                <input ng-model="userLike" class="form-control"
                       placeholder="{{ (selectLang == 'English') ? 'enter keywords' : '\u8bf7\u8f93\u5165\u5173\u952e\u5b57' }}"
                       type="text" autocomplete="off">
                <span class="input-group-btn">
                    <button class="btn btn-success font-bold" type="button" ng-click="refreshUserListData()">
                        <span translate="business.navtitle.search_patient">Search</span>
                    </button>
                </span>
            </div>
            <br>
            <span ng-repeat="ur in userRoles">
	        	<button class="btn m-b-sm w-xs  font-bold {{ buttonClass[$index] }}" ng-disabled="ur.disabled"
                        ng-click="refreshUserListData(ur.key)">
                    {{ (selectLang == 'English') ? ur.enName : ur.cnName }}
                </button>
        	</span>
        </div>
        <table class="table table-striped b-t b-light">
            <thead>
            <tr class="panel-heading">
                <th><span class="font-bold" translate="common.number">No.</span></th>
                <th><span class="font-bold" translate="user.username">Username</span></th>
                <th ng-if="!isSmart"><span class="font-bold" translate="user.realname">Real Name</span></th>
                <th ng-if="!isSmart && userRole=='doctor'"><span class="font-bold" translate="user.doctortype">Doctor Type</span>
                </th>
                <th ng-if="!isSmart && userRole=='doctor'"><span class="font-bold" translate="user.countOfPatient">Patient</span>
                </th>
                <th ng-if="!isSmart && userRole=='doctor'"><span class="font-bold"
                                                                 translate="user.countOfSend">Sending</span>
                </th>
                <th ng-if="!isSmart && userRole=='doctor'"><span class="font-bold" translate="user.fee_recommend">fee_recommend</span>
                </th>
                <th ng-if="!isSmart && userRole=='MedicalAdmin'"><span class="font-bold"
                                                                       translate="user.countOfSelect">Selection</span>
                </th>
                <th ng-if="!isSmart && userRole=='Specialist'"><span class="font-bold" translate="user.countOfDiag">Diagnosis</span>
                </th>
                <th ng-if="!isSmart && userRole=='Specialist'"><span class="font-bold" translate="user.fee_diag">fee_Diag</span>
                </th>
                <th ng-if="!isSmart && userRole=='Specialist'"><span class="font-bold"
                                                                     translate="user.fee_solution">fee_solution</span>
                </th>
                <th ng-if="!isSmart && userRole=='Surgeon'"><span class="font-bold" translate="user.cost_surgery">cost_surgery</span>
                </th>
                <th ng-if="!isSmart && userRole=='Surgeon'"><span class="font-bold" translate="user.fee_surgery">fee_surgery</span>
                </th>
                <th ng-if="!isSmart"><span class="font-bold" translate="user.mobilephone">Mobile</span></th>
                <th><span class="font-bold" translate="common.operate">Operate</span></th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="model in users">
                <td>{{ (page.currentPage-1)*page.itemsPerPage + $index + 1 }}</td>
                <td>{{ model.userName }}</td>
                <td ng-if="!isSmart">{{ model.realName }}</td>
                <td ng-if="!isSmart && userRole=='doctor'">
                    {{(!model.isSpecialist && !model.isSurgeon) ? '[' + ('business.servreq.Regional_name' |
                    translate) + ']' : ''}}
                    {{model.isSpecialist ? '[' + ('business.servreq.Expert_name' | translate) + ']' : ''}}
                    {{model.isSurgeon ? '[' + ('business.servreq.Operator_name' | translate) + ']' : ''}}
                </td>
                <td ng-if="!isSmart && userRole=='doctor'">{{model.countOfPatient}}</td>
                <td ng-if="!isSmart && userRole=='doctor'">{{model.countOfSend}}</td>
                <td ng-if="!isSmart && userRole=='doctor'">{{model._doctor.fee_Recommend}}</td>
                <td ng-if="!isSmart && userRole=='MedicalAdmin'">{{model.countOfSelect}}</td>
                <td ng-if="!isSmart && userRole=='Specialist'">{{model.countOfDiag}}</td>
                <td ng-if="!isSmart && userRole=='Specialist'">{{model._doctor.fee_Diag}}</td>
                <td ng-if="!isSmart && userRole=='Specialist'">{{model._doctor.fee_Solution}}</td>
                <td ng-if="!isSmart && userRole=='Surgeon'">{{model._doctor.cost_Surgery}}</td>
                <td ng-if="!isSmart && userRole=='Surgeon'">{{model._doctor.fee_Surgery}}</td>
                <td ng-if="!isSmart">{{ model.mobile_Phone }}</td>
                <td>
                    <div>
                        <button type="button"
                                ng-click="open({ templateUrl: 'openUserInfoo.html'}, {{ model }} );"
                                class="btn btn-sm btn-primary font-bold"
                                title="{{ 'common.details' | translate }}"
                                translate="common.details">
                        </button>
                        <button type="button"
                                ng-click="open({ templateUrl: 'editUserInfo.html'}, {{ model }} );"
                                class="btn btn-sm btn-warning font-bold"
                                title="{{ 'common.edit' | translate }}"
                                translate="common.edit">
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 text-left">
                    <small class="text-muted inline m-t-sm m-b-sm">
                        <span translate="common.showing"></span>
                        {{page.totalItems==0?0:(page.currentPage-1)*page.itemsPerPage+1}} -
                        {{(page.currentPage-1)*page.itemsPerPage+page.currentItems}}
                        <span translate="common.of"></span>
                        {{page.totalItems}}
                        <span translate="common.items"></span>
                    </small>
                </div>
                <div class="col-sm-8 text-right text-center-xs">
                    <pagination ng-model="page.currentPage" ng-change="pageChanged()"
                                total-items="page.totalItems" items-per-page="page.itemsPerPage"
                                max-size="page.maxSize" class="pagination-sm m-t-none m-b"
                                boundary-links="true" rotate="false" previous-text="&lsaquo;"
                                next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></pagination>
                </div>
            </div>
        </footer>
    </div>
    <script type="text/ng-template" id="openUserInfoo.html">
        <div ng-include="'views/system/user_detail.html?tmp=2'"></div>
    </script>
    <script type="text/ng-template" id="editUserInfo.html">
        <div ng-include="'views/system/user_add.html?tmp=2'"></div>
    </script>
</div>